package MsgPackage;

/**
 * @author Omri Barda		039725890 
 * @author Amit Joseph		034608547
 * @author Gilad Shpigel  	300162393
 * @author Elad Elbaz		040539959
 * @version June 2012
 */

import java.util.ArrayList;
import entities.ExtractedExam;
import entities.Question;
import entities.QuestionPerExam;
import entities.Student;

public class GetExaminedPack extends MessagePack {

	private static final long serialVersionUID = 1L;
	private ExtractedExam exm;
	private Student stdnt;
	private ArrayList<QuestionPerExam> examQuestionsArr;
	private String examStudentInstructions;

	/**
	 * constructor
	 * 
	 * @param studnt
	 * @param exmCode
	 */
	public GetExaminedPack(Student studnt, String exmCode) {
		this.op = OpType.GetExamined;
		stdnt = studnt;
		exm = new ExtractedExam();
		exm.setExamCode(exmCode);
	}

	/**
	 * 
	 * @return the student instruction
	 */
	public String getstudentInstructions() {
		return examStudentInstructions;
	}

	/**
	 * 
	 * @param studentInstructions
	 *            of exam
	 */
	public void setStudentInstructions(String studentInstructions) {
		examStudentInstructions = studentInstructions;
	}

	/**
	 * 
	 * @param extrct
	 *            the exam to set
	 */
	public void setExtractedExam(ExtractedExam extrct) {
		exm = extrct;
	}

	/**
	 * 
	 * @return the extracted exam
	 */
	public ExtractedExam getExtractedExam() {
		return exm;
	}

	/**
	 * 
	 * @return the exam code
	 */
	public String getExamCode() {
		return exm.getExamCode();
	}

	/**
	 * 
	 * @param exmCode
	 *            the exam code to set
	 */
	public void setExamCode(String exmCode) {
		exm.setExamCode(exmCode);
	}

	/**
	 * 
	 * @return the number of questions
	 */
	public int GetNumOfQuestions() {
		int temp;
		temp = examQuestionsArr.size();
		return temp;
	}

	/**
	 * 
	 * @return the student
	 */
	public Student GetStudent() {
		return stdnt;
	}

	/**
	 * 
	 * @return the exam questions
	 */
	public ArrayList<QuestionPerExam> getQuestions() {
		return examQuestionsArr;
	}

	/**
	 * 
	 * @param arr
	 *            the exam list to set
	 */
	public void setQuestionsArray(ArrayList<QuestionPerExam> arr) {
		examQuestionsArr = new ArrayList<QuestionPerExam>();
		examQuestionsArr.addAll(arr);
	}

	/**
	 * 
	 * @param qstn
	 *            to add to the exam
	 */
	public void addOneQuestionPerExam(QuestionPerExam qstn) {
		examQuestionsArr.add(qstn);
	}

	/**
	 * 
	 * @param qstn
	 *            the question to add
	 * @param index
	 *            of the question in the list
	 */
	public void addQuestionPerExam(Question qstn, int index) {
		examQuestionsArr.get(index).setQuestion(qstn);
	}

}
